﻿namespace Example
{
    using System;

    using NSpec;

    /// <summary>
    /// NSpecRunner.exe Example.Specifications\bin\debug\Example.Specifications.dll
    /// in Package Manager Console.
    /// </summary>
    public sealed class TallySpecifications : nspec
    {
        private Tally _tally;

        public void a_new_tally()
        {
            before = () => _tally = new Tally();
            it["should be zero"] = () => _tally.Value.should_be(0);
            it["should prevent decrement"] = expect<InvalidOperationException>(() => _tally.Decrement());
            context["when incremented"] =
                () =>
                    {
                        before = () => _tally.Increment();
                        it["the value should have increased by 1"] = () => _tally.Value.should_be(1);
                    };
        }
    }
}